//
//  HomeListenTableViewHeaderView.swift
//  TianTianBiTing
//
//  Created by Gox mac 2 on 2018/12/20.
//  Copyright © 2018 Gox_WallyDiao. All rights reserved.
//

import UIKit

protocol HomeListenTableViewHeaderViewDelegate:NSObjectProtocol {
    func homeListenTableViewHeaderViewAction()
}

class HomeListenTableViewHeaderView: UITableViewHeaderFooterView {
    
    var delegate:HomeListenTableViewHeaderViewDelegate?

    let leftLabel = UILabel()
    let rightBtn = UIButton()
    
    override init(reuseIdentifier: String?) {
        super.init(reuseIdentifier: reuseIdentifier)
        let whiteView = UIView.init(frame: FRAME_CGFloat(0, 0, SCREEN_WIDTH, 30))
        whiteView.backgroundColor = WhiteBackColor
        contentView.addSubview(whiteView)
        self.leftLabel.text = "热听榜单"
        self.leftLabel.textColor = BlackBackColor
        self.leftLabel.font = Font_Medium(17)
        self.leftLabel.frame = FRAME_CGFloat(15, 0, 100, 25)
        self.leftLabel.textAlignment = .left
        contentView.addSubview(self.leftLabel)
        
        self.rightBtn.setTitle("点击更多", for: .normal)
        self.rightBtn.setTitleColor(RGB(255, 151, 29), for: .normal)
        self.rightBtn.titleLabel?.font = UIFont.boldSystemFont(ofSize: 14)
        self.rightBtn.frame = FRAME_CGFloat(SCREEN_WIDTH - 90, 3, 90, 20)
        self.rightBtn.addTarget(self, action: #selector(moreAction), for: .touchUpInside)
        contentView.addSubview(self.rightBtn)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    @objc func moreAction() {
        self.delegate?.homeListenTableViewHeaderViewAction()
    }
    
}
